package day14.Executors;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Lian01 {
    public static void main(String[] args) throws InterruptedException {
//       创建一个默认的线程对象,池子中默认是空的,默认最多可以容纳int类型的最大值;
        ExecutorService executorService = Executors.newCachedThreadPool();
//        Executors  可以帮我们创建线程池对象
//        Executors控制线程池
        executorService.submit(() -> System.out.println(Thread.currentThread().getName() + "在执行了"));
        Thread.sleep(1000);
        executorService.submit(() -> System.out.println(Thread.currentThread().getName() + "在执行了"));
        executorService.shutdown();
    }
}
